#ifndef _FOC_H__
#define _FOC_H__

#include "os/types.h"
#include "math/fast_math.h"
#include "controller/pi.h"
#include "controller/mc_config.h"
#include "config.h"

typedef struct {
	float a;
	float b;
}albt_t;

typedef struct {
	float d;
	float q;
}dq_t;

typedef struct {
	float   	 ts;
	pi_t         pi_curr_id;
	pi_t         pi_curr_iq;
	dq_t         curr_dq_real;
	dq_t         curr_dq_filted;
	dq_t         curr_dq_set;
	float        m_velocity;
	float        phase_angle;
	float        vbus_vol;
	float        phase_sin;
	float        phase_cos;
	float  		 e_velocity;    //电机的电角速度	
	float        duty_norm[3];
	u8           sector;
	dq_t         vol_dq_out;
	dq_t         vol_dq_set;
	albt_t       vol_albt_out;
	bool    	 b_openloop;
}foc_t;

void foc_init(foc_t *foc);
void foc_update_svpwm(foc_t *foc);

#endif /* _FOC_H__ */

